package org.luxor.commons.jdbc.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.luxor.commons.core.utils.DateUtils;
import org.luxor.commons.jdbc.annotation.EncryptField;
import org.luxor.commons.jdbc.handle.PassWordHandler;

import java.time.LocalDateTime;

/**
 * @author Mr.Yan  @date 2019/9/25$
 */
@ApiModel("用户表")
public class User {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    @ApiModelProperty(value = "租户ID", example = "10000")
    private Long tenantId;
    @ApiModelProperty(value = "账号", example = "test")
    private String username;
    @TableField(typeHandler = PassWordHandler.class)
    @ApiModelProperty(value = "密码", example = "test@123")
    private String pwd;
    @ApiModelProperty(value = "真实姓名", example = "杨过")
    private String realName;
    @ApiModelProperty(value = "年龄", example = "18")
    private Integer age;
    @ApiModelProperty(value = "性别", example = "男")
    private Integer sex;
    @ApiModelProperty(value = "邮箱", example = "yanguo@163.com")
    private String email;

    @EncryptField
    @ApiModelProperty(value = "手机号码", example = "13112246126")
    private String phone;

    @ApiModelProperty(value = "创建时间", example = "2018/08/08 00:00:00")
    @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
    private LocalDateTime createTime;

    @TableLogic
    @ApiModelProperty(value = "逻辑删除", hidden = true)
    private Integer delete;
    @Version
    @ApiModelProperty(value = "乐观锁", hidden = true)
    private Integer version;
    @TableField(value = "数据库不存在的字段", exist = false)
    private String remark;

    public User() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Integer getDelete() {
        return delete;
    }

    public void setDelete(Integer delete) {
        this.delete = delete;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", tenantId=" + tenantId +
                ", username='" + username + '\'' +
                ", pwd='" + pwd + '\'' +
                ", realName='" + realName + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                ", email='" + email + '\'' +
                ", phone='" + phone + '\'' +
                ", createTime=" + createTime +
                ", delete=" + delete +
                ", version=" + version +
                ", remark='" + remark + '\'' +
                '}';
    }
}
